package com.handpay.zztong.hp.base.model.banklist;

import com.handpay.zztong.hp.accountcenter.model.SubBankBean;
import com.handpay.zztong.hp.log.HPLog;

import java.io.Serializable;

public class Bank implements Serializable {

    private static final long serialVersionUID = -1122576365916220535L;
    public static final String INVALID_BANK_CODE = "-1";
    private String mBankCode = INVALID_BANK_CODE;
    private String mBankName = null;
    private String mSubBankFlag = null;
    private String mProvinceFlag = null;
    private String mAreaFlag = null;

    public String getBankCode() {
        return mBankCode;
    }

    public void setBankCode(String mBankCode) {
        this.mBankCode = mBankCode;
    }

    public String getBankName() {
        return mBankName;
    }

    public void setBankName(String mBankName) {
        this.mBankName = mBankName;
    }

    public String getSubBankFlag() {
        return mSubBankFlag;
    }

    public void setSubBankFlag(String subBankFlag) {
        this.mSubBankFlag = subBankFlag;
    }

    public String getProvinceFlag() {
        return mProvinceFlag;
    }

    public void setProvinceFlag(String provinceFlag) {
        this.mProvinceFlag = provinceFlag;
    }

    public String getAreaFlag() {
        return mAreaFlag;
    }

    public void setAreaFlag(String AreaFlag) {
        this.mAreaFlag = AreaFlag;
    }

    public static Bank generateBank(BankListBean.ListBean bankBean) {
        Bank bank = new Bank();
        try {
//			a.setBankCode((String)data.rawget("bankCode"));
//			a.setBankName((String) data.rawget("bankName"));
//			a.setSubBankFlag((String)data.rawget("subBankFlag"));
//			a.setProvinceFlag((String)data.rawget("provinceFlag"));
//			a.setAreaFlag((String)data.rawget("areaFlag"));
            bank.setBankCode(bankBean.getBankCode());
            bank.setBankName(bankBean.getBankName());
            bank.setSubBankFlag(bankBean.getSubBankFlag());
            bank.setProvinceFlag(bankBean.getProvinceFlag());
            bank.setAreaFlag(bankBean.getAreaFlag());
            return bank;
        } catch (Exception e) {
            HPLog.e("jjyang", "generateSubBank", e);
            return null;
        }
    }

    public static Bank generateSubBank(SubBankBean.ListBean listBean) {
        Bank a = new Bank();
//        try {
//            a.setBankCode((String) data.rawget("subBankCode"));
//            a.setBankName((String) data.rawget("subBankName"));
//            return a;
//        } catch (Exception e) {
//            HPLog.e("jjyang", "generateSubBank", e);
//            return null;
//        }
        a.setBankCode(listBean.getSubBankCode());
        a.setBankName(listBean.getSubBankName());
        return a;
    }

    @Override
    public String toString() {
        return "Bank{" + "mBankCode='" + mBankCode + '\'' + ", mBankName='" + mBankName + '\'' + ", mSubBankFlag='" + mSubBankFlag + '\'' + ", mProvinceFlag='" + mProvinceFlag + '\'' + ", mAreaFlag='" + mAreaFlag + '\'' + '}';
    }
}
